package com.eastfair.mobile.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.eastfair.boot.request.PageParams;
import com.eastfair.core.base.R;
import com.eastfair.mobile.service.MobileViolationRecordService;
import com.eastfair.venueservice.dto.ViolationRecordDTO;
import com.eastfair.venueservice.dto.ViolationRecordPageQuery;
import com.eastfair.venueservice.vo.ViolationRecordVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;


/**
 * <p>
 * 前端控制器
 * 违规处罚记录
 * </p>
 *
 * @author lyw
 * @date 2022-08-11
 */
@Deprecated
@Slf4j
@Validated
@RestController
@RequestMapping("/violationRecord")
@Api(value = "ViolationRecord", tags = "违规处罚记录")
public class MobileViolationRecordController {

    @Autowired
    private MobileViolationRecordService mobileViolationRecordService;


    /**
     * 保存违规惩罚记录
     *
     * @param violationRecordDTO
     * @return
     */
    @ApiOperation(value = "保存违规惩罚记录")
    @PostMapping(value = "/saveViolationRecordInfo")
    public R<Boolean> saveViolationRecordInfo(@RequestBody ViolationRecordDTO violationRecordDTO) {

        return R.success(mobileViolationRecordService.saveViolationRecordInfo(violationRecordDTO));

    }


    /**
     * 查询违规惩罚记录列表分页
     *
     * @param params
     * @return
     */
    @ApiOperation(value = "查询违规惩罚记录列表分页")
    @PostMapping(value = "/queryViolationRecordList")
    public R<Page<ViolationRecordVO>> queryViolationRecordList(@RequestBody PageParams<ViolationRecordDTO> params) {

        Page<ViolationRecordVO> page = mobileViolationRecordService.queryViolationRecordList(params);
        return R.success(page);

    }

    /**
     * 查询违规惩罚记录详情
     *
     * @param violationRecordDTO
     * @return
     */
    @ApiOperation(value = "查询违规惩罚记录详情")
    @PostMapping(value = "/queryViolationRecordInfo")
    public R<ViolationRecordVO> queryViolationRecordInfo(@RequestBody ViolationRecordDTO violationRecordDTO) {

        ViolationRecordVO violationRecordVO = mobileViolationRecordService.queryViolationRecordInfo(violationRecordDTO);
        return R.success(violationRecordVO);
    }


    /**
     * 修改违规惩罚记录
     * @param violationRecordDTO
     * @return
     */
    @ApiOperation(value = "修改违规惩罚记录")
    @PostMapping(value = "/updateViolationRecordInfo")
    public R<Boolean> updateViolationRecordInfo(@RequestBody ViolationRecordDTO violationRecordDTO){

     return R.success(mobileViolationRecordService.updateViolationRecordInfo(violationRecordDTO));

    }


    /**
     * 删除违规惩罚记录
     * @return
     */
    @ApiOperation(value = "删除违规惩罚记录")
    @GetMapping(value = "/delViolationRecordInfo/{id}")
    public R<Boolean> delViolationRecordInfo(@PathVariable Long id){

     return R.success(mobileViolationRecordService.delViolationRecordInfo(id));

    }


}